import rsa
import base64

#(pubkey,privkey)=rsa.newkeys(512)
#print(pubkey,privkey)
##'''
##PublicKey(7510913186243183713348013886711364869124351471084246229662807854413168368007435266055217407553762197323227735440140718947488454304701879021534706208575041, 65537) PrivateKey(7510913186243183713348013886711364869124351471084246229662807854413168368007435266055217407553762197323227735440140718947488454304701879021534706208575041, 65537, 3907939465305191287996916635228509554484814086889874608011841937037621923955257100435437887223632595984378089171079614155266555358584601146248176202005773, 4411561936946076075738137017436787111287447829259743591983111276201350653650885671, 1702551906466635196513667615266653865877847087063208861264077811208944471)
##'''


##公钥加密
##加代加密的字符串使用utf-8编码成字节
#content='abcd'.encode('utf-8')
##使用公钥对待加密的字节进行rsa公钥加密
#encrypt_res=rsa.encrypt(content,pubkey)
#print(encrypt_res)
##'''
##b'\x8b\xb2(\x1d\xa9\x7f\xfb\x03\xb9m\x06\xce\xc0\xff\x85\xea<\x90\xc1N\xec\xc6C\x9e}T\xea&\xcfp\x14\x81\n\xd7\xae\x1e\x16\xeeH\x12\xd3\x1f\x0cb\xa6\xd0#y\x07\xa8F\xc4 O\x93\x08a\xf4\x7fVy\x083+'
##'''



##私钥解密
##对已经加密的字节结果，使用rsa的私钥解密
#content=rsa.decrypt(encrypt_res,privkey)
##将解密后的结果使用utf-8解码为人可读
#con=content.decode('utf-8')
#print(con)
##'''
##abcd
##'''

 
pem="""-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbE3bmvurB5YeXsp/FHULgo/2P
lGtOYpuhU4lshhooH0aUCEqherfrJ1TDtqPFKZgkK/Dm8CLEHYIn90szyRNAFrLY
gl3JkEQjFkqvR6U7TxW5xxyWqd5bQvItFk8fD4Ok9+ngWLZoLTxp48bEF6G7W+Fg
v1xSkxpCP7+HnszpYQIDAQAB
-----END PUBLIC KEY-----
 """

publicKey=rsa.PublicKey.load_pkcs1_openssl_pem(bytes(pem,encoding='utf8'))

x=0
while x<10:
  crypto= rsa.encrypt(bytes("1648717845",encoding='utf8'),publicKey)
  print(base64.urlsafe_b64encode(crypto))
  x+=1

